<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  

  
  <title>gitalk 插件官方文档</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="hexo-plugin-gitalk 插件官方文档">
<meta name="keywords" content="hexo-plugin-gitalk,gitbook-plugin-mygitalk,gitalk,gitment,discuss,comment,issues,github,hexo,gitbook">
<meta property="og:type" content="website">
<meta property="og:title" content="gitalk 插件官方文档">
<meta property="og:url" content="https://snowdreams1006.github.io/hexo-plugin-gitalk/index.html">
<meta property="og:site_name" content="gitalk 插件官方文档">
<meta property="og:description" content="hexo-plugin-gitalk 插件官方文档">
<meta property="og:locale" content="zh-CN">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="gitalk 插件官方文档">
<meta name="twitter:description" content="hexo-plugin-gitalk 插件官方文档">
  
    <link rel="alternate" href="/hexo-plugin-gitalk/atom.xml" title="gitalk 插件官方文档" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/hexo-plugin-gitalk/css/style.css">
</head>
</html>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/hexo-plugin-gitalk/" id="logo">gitalk 插件官方文档</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/hexo-plugin-gitalk/" id="subtitle">hexo-plugin-gitalk</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/hexo-plugin-gitalk/">Home</a>
        
          <a class="main-nav-link" href="/hexo-plugin-gitalk/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/hexo-plugin-gitalk/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="搜索"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="https://snowdreams1006.github.io/hexo-plugin-gitalk"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-README" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/hexo-plugin-gitalk/2019/10/16/README/" class="article-date">
  <time datetime="2019-10-15T17:47:52.000Z" itemprop="datePublished">2019-10-16</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/hexo-plugin-gitalk/2019/10/16/README/">首页</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <div id="vip-container"><h1 id="欢迎访问-hexo-plugin-gitalk-官网-👋"><a href="#欢迎访问-hexo-plugin-gitalk-官网-👋" class="headerlink" title="欢迎访问 hexo-plugin-gitalk 官网 👋"></a>欢迎访问 hexo-plugin-gitalk 官网 👋</h1><p><a href="https://www.npmjs.com/package/hexo-plugin-gitalk" target="_blank" rel="noopener"><img src="https://img.shields.io/npm/v/hexo-plugin-gitalk.svg" alt="npm:version"></a><br><a href="https://www.npmjs.com/package/hexo-plugin-gitalk" target="_blank" rel="noopener"><img src="https://img.shields.io/npm/dt/hexo-plugin-gitalk.svg" alt="npm:download"></a><br><a href="https://github.com/snowdreams1006/hexo-plugin-gitalk#readme" target="_blank" rel="noopener"><img src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" alt="github:documentation"></a><br><a href="https://github.com/snowdreams1006/hexo-plugin-gitalk/graphs/commit-activity" target="_blank" rel="noopener"><img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" alt="github:maintenance"></a><br><a href="https://github.com/snowdreams1006/hexo-plugin-gitalk/blob/master/LICENSE" target="_blank" rel="noopener"><img src="https://img.shields.io/npm/l/hexo-plugin-gitalk.svg" alt="npm:license"></a><br><a href="https://github.com/snowdreams1006" target="_blank" rel="noopener"><img src="https://img.shields.io/badge/github-snowdreams1006-brightgreen.svg" alt="github:snodreams1006"></a><br><a href="https://snowdreams1006.github.io/snowdreams1006-wechat-public.jpeg"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1%E5%85%AC%E4%BC%97%E5%8F%B7-%E9%9B%AA%E4%B9%8B%E6%A2%A6%E6%8A%80%E6%9C%AF%E9%A9%BF%E7%AB%99-brightgreen.svg" alt="微信公众号:雪之梦技术驿站-brightgreen.svg"></a></p>
<blockquote>
<p>Hexo 整合 gitalk 组件实现博客评论功能</p>
</blockquote>
<h3 id="🏠-主页"><a href="#🏠-主页" class="headerlink" title="🏠 主页"></a>🏠 <a href="https://github.com/snowdreams1006/hexo-plugin-gitalk#readme" target="_blank" rel="noopener">主页</a></h3><ul>
<li>Github : <a href="https://snowdreams1006.github.io/hexo-plugin-gitalk/">https://snowdreams1006.github.io/hexo-plugin-gitalk/</a></li>
<li>Gitee : <a href="https://snowdreams1006.gitee.io/hexo-plugin-gitalk/" target="_blank" rel="noopener">https://snowdreams1006.gitee.io/hexo-plugin-gitalk/</a></li>
<li>Gitlab : <a href="https://snowdreams1006.gitlab.io/hexo-plugin-gitalk/" target="_blank" rel="noopener">https://snowdreams1006.gitlab.io/hexo-plugin-gitalk/</a></li>
</ul>
<h2 id="效果"><a href="#效果" class="headerlink" title="效果"></a>效果</h2><p><img src="https://raw.githubusercontent.com/snowdreams1006/hexo-plugin-gitalk/master/gitalk-use-preview.png" alt="gitalk-use-preview.png"></p>
<h2 id="用法"><a href="#用法" class="headerlink" title="用法"></a>用法</h2><h3 id="Step-1-更新-config-yml-配置文件"><a href="#Step-1-更新-config-yml-配置文件" class="headerlink" title="Step #1 - 更新 _config.yml 配置文件"></a>Step #1 - 更新 <code>_config.yml</code> 配置文件</h3><p>在 <code>_config.yml</code> 配置文件中,配置 <code>gitalk</code> 插件相关信息,详情见 <a href="https://github.com/gitalk/gitalk" target="_blank" rel="noopener">gitalk</a>.</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">plugins:</span></span><br><span class="line">  <span class="attr">gitalk:</span></span><br><span class="line">    <span class="attr">clientID:</span> <span class="string">GitHub</span> <span class="string">Application</span> <span class="string">Client</span> <span class="string">ID</span></span><br><span class="line">    <span class="attr">clientSecret:</span> <span class="string">GitHub</span> <span class="string">Application</span> <span class="string">Client</span> <span class="string">Secret</span></span><br><span class="line">    <span class="attr">repo:</span> <span class="string">GitHub</span> <span class="string">repo</span></span><br><span class="line">    <span class="attr">owner:</span> <span class="string">GitHub</span> <span class="string">repo</span> <span class="string">owner</span></span><br><span class="line">    <span class="attr">admin:</span> </span><br><span class="line">      <span class="bullet">-</span> <span class="string">GitHub</span> <span class="string">repo</span> <span class="string">owner</span> <span class="string">and</span> <span class="string">collaborators,</span> <span class="string">only</span> <span class="string">these</span> <span class="string">guys</span> <span class="string">can</span> <span class="string">initialize</span> <span class="string">github</span> <span class="string">issues</span></span><br><span class="line">    <span class="attr">distractionFreeMode:</span> <span class="literal">false</span></span><br></pre></td></tr></table></figure>

<blockquote>
<p>注意: 前往 <a href="https://github.com/gitalk/gitalk" target="_blank" rel="noopener">gitalk</a> 申请开通 <code>gitalk</code> 功能后,<strong>一定要替换成自己的相关配置</strong>!</p>
</blockquote>
<p>其中,主要配置参数含义如下: </p>
<ul>
<li><p><strong>clientID</strong> <code>String</code> </p>
<p><strong>必须</strong>. GitHub Application Client ID.</p>
</li>
<li><p><strong>clientSecret</strong> <code>String</code> </p>
<p><strong>必须</strong>. GitHub Application Client Secret.</p>
</li>
<li><p><strong>repo</strong> <code>String</code> </p>
<p><strong>必须</strong>. GitHub repository.</p>
</li>
<li><p><strong>owner</strong> <code>String</code> </p>
<p><strong>必须</strong>. GitHub repository 所有者，可以是个人或者组织。</p>
</li>
<li><p><strong>admin</strong> <code>Array</code> </p>
<p><strong>必须</strong>. GitHub repository 的所有者和合作者 (对这个 repository 有写权限的用户)。</p>
</li>
<li><p><strong>distractionFreeMode</strong> <code>Boolean</code> </p>
<p>Default: false。</p>
<p>类似Facebook评论框的全屏遮罩效果.</p>
</li>
</ul>
<h3 id="Step-2-运行-hexo-相关命令"><a href="#Step-2-运行-hexo-相关命令" class="headerlink" title="Step #2 - 运行 hexo 相关命令"></a>Step #2 - 运行 hexo 相关命令</h3><ul>
<li>运行 <code>npm install</code> 命令安装到本地项目</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-plugin-gitalk --save</span><br></pre></td></tr></table></figure>

<ul>
<li>运行 <code>hexo generate</code> 命令构建本地项目或者 <code>hexo server</code> 启动本地服务.</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>

<p>或者</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>

<blockquote>
<p>注意: 本地测试时无法正常运行,必须是线上环境才会生效,且必须由管理员登录github进行初始化.</p>
</blockquote>
<h2 id="示例"><a href="#示例" class="headerlink" title="示例"></a>示例</h2><p>不仅 <a href="https://github.com/snowdreams1006/hexo-plugin-gitalk" target="_blank" rel="noopener">hexo-plugin-gitalk</a> <strong>官方文档</strong>已整合 <code>gitalk</code> 版权保护插件,此外还提供了示例项目,详情参考 <code>example</code> 目录.</p>
<ul>
<li><a href="https://github.com/snowdreams1006/hexo-plugin-gitalk/tree/master/docs" target="_blank" rel="noopener">官方文档</a></li>
<li><a href="https://github.com/snowdreams1006/hexo-plugin-gitalk/tree/master/example" target="_blank" rel="noopener">官方示例</a></li>
</ul>
<h2 id="作者"><a href="#作者" class="headerlink" title="作者"></a>作者</h2><p>👤 <strong>snowdreams1006</strong></p>
<ul>
<li>Github: <a href="https://github.com/snowdreams1006" target="_blank" rel="noopener">@snowdreams1006</a></li>
<li>Email: <a href="mailto:snowdreams1006@163.com" target="_blank" rel="noopener">snowdreams1006@163.com</a></li>
</ul>
<h2 id="🤝-贡献"><a href="#🤝-贡献" class="headerlink" title="🤝 贡献"></a>🤝 贡献</h2><p>如果你想贡献自己的一份力量,欢迎提交 <a href="https://github.com/snowdreams1006/hexo-plugin-gitalk/issues" target="_blank" rel="noopener"><code>Issues</code></a> 或者 <code>Pull Request</code> 请求!</p>
<h2 id="支持"><a href="#支持" class="headerlink" title="支持"></a>支持</h2><p>如果本项目对你有所帮助,欢迎 ⭐️ <a href="https://github.com/snowdreams1006/hexo-plugin-gitalk" target="_blank" rel="noopener">hexo-plugin-gitalk</a> 项目,感谢你的支持与认可!</p>
<h2 id="📝-版权"><a href="#📝-版权" class="headerlink" title="📝 版权"></a>📝 版权</h2><p>Copyright © 2019 <a href="https://github.com/snowdreams1006" target="_blank" rel="noopener">snowdreams1006</a>.</p>
<p>This project is <a href="https://github.com/snowdreams1006/hexo-plugin-gitalk/blob/master/LICENSE" target="_blank" rel="noopener">MIT</a> licensed.</p>

<div id="gitalk-container"></div>
<script src="https://cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js"></script><link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css"><script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>

		<script>
		var gitalkConfig = {"clientID":"3f62415a283d19cbd696","clientSecret":"aed0e1db0620bf5d0e3a3f0225f801997ad74e58","repo":"hexo-plugin-gitalk","owner":"snowdreams1006","admin":["snowdreams1006"],"distractionFreeMode":false};
	    gitalkConfig.id = md5(location.pathname);
		var gitalk = new Gitalk(gitalkConfig);
	    gitalk.render("gitalk-container");
	    </script></div>

			<script src="https://my.openwrite.cn/js/readmore.js" type="text/javascript"></script>
			<script>
			var isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
			if (!isMobile) {
			    var btw = new BTWPlugin();
			    btw.init({
			        "id": "vip-container",
			        "blogId": "15702-1569305559839-744",
			        "name": "雪之梦技术驿站",
			        "qrcode": "https://snowdreams1006.github.io/snowdreams1006-wechat-public.jpeg",
			        "keyword": "vip"
			    });
			}
			</script>
		
      
    </div>
    <footer class="article-footer">
      <a data-url="https://snowdreams1006.github.io/hexo-plugin-gitalk/2019/10/16/README/" data-id="ck2wrr71m0000cueaibecxcpv" class="article-share-link">Share</a>
      
      
    </footer>
  </div>
  
</article>






  


</section>
        
          <aside id="sidebar">
  
    

  
    

  
    
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">归档</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/hexo-plugin-gitalk/archives/2019/10/">十月 2019</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/hexo-plugin-gitalk/2019/10/16/README/">首页</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2019 snowdreams1006<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/hexo-plugin-gitalk/" class="mobile-nav-link">Home</a>
  
    <a href="/hexo-plugin-gitalk/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/hexo-plugin-gitalk/fancybox/jquery.fancybox.css">
  <script src="/hexo-plugin-gitalk/fancybox/jquery.fancybox.pack.js"></script>


<script src="/hexo-plugin-gitalk/js/script.js"></script>



  </div>
</body>
</html>